package com.eastfair.venuebooking.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 商机
 * </p>
 *
 * @author dqq
 * @since 2023-04-03
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("vb_business_opportunity")
@ApiModel(value = "BusinessOpportunity", description = "商机")
@AllArgsConstructor
public class BusinessOpportunity extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用：1是；0否
     */
    @ApiModelProperty(value = "是否启用：1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用：1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 归属人员部门id
     */
    @ApiModelProperty(value = "归属人员部门id")
    @TableField(value = "org_code")
    @Excel(name = "归属人员部门id")
    private Long orgCode;

    /**
     * 归属部门
     */
    @ApiModelProperty(value = "归属部门")
    @Size(max = 64, message = "归属部门长度不能超过64")
    @TableField(value = "org_name", condition = LIKE)
    @Excel(name = "归属部门")
    private String orgName;

    /**
     * 前归属部门ID
     */
    @ApiModelProperty(value = "前归属部门ID")
    @TableField(value = "last_org_code")
    @Excel(name = "前归属部门ID")
    private Long lastOrgCode;

    /**
     * 前归属部门名称
     */
    @ApiModelProperty(value = "前归属部门名称")
    @Size(max = 64, message = "前归属部门名称长度不能超过64")
    @TableField(value = "last_org_name", condition = LIKE)
    @Excel(name = "前归属部门名称")
    private String lastOrgName;

    /**
     * 归属人员
     */
    @ApiModelProperty(value = "归属人员")
    @TableField(value = "belong_to")
    @Excel(name = "归属人员")
    private Long belongTo;

    /**
     * 归属人姓名
     */
    @ApiModelProperty(value = "归属人姓名")
    @Size(max = 255, message = "归属人姓名长度不能超过255")
    @TableField(value = "belong_to_name", condition = LIKE)
    @Excel(name = "归属人姓名")
    private String belongToName;

    /**
     * 前归属人id
     */
    @ApiModelProperty(value = "前归属人id")
    @TableField(value = "last_belong_to")
    @Excel(name = "前归属人id")
    private Long lastBelongTo;

    /**
     * 前归属人姓名
     */
    @ApiModelProperty(value = "前归属人姓名")
    @Size(max = 255, message = "前归属人姓名长度不能超过255")
    @TableField(value = "last_belong_to_name", condition = LIKE)
    @Excel(name = "前归属人姓名")
    private String lastBelongToName;

    /**
     * 商机标题
     */
    @ApiModelProperty(value = "商机标题")
    @Size(max = 255, message = "商机标题长度不能超过255")
    @TableField(value = "business_title", condition = LIKE)
    @Excel(name = "商机标题")
    private String businessTitle;

    /**
     * 客户id
     */
    @ApiModelProperty(value = "客户id")
    @TableField(value = "customer_id")
    @Excel(name = "客户id")
    private Long customerId;

    /**
     * 客户名称
     */
    @ApiModelProperty(value = "客户名称")
    @Size(max = 64, message = "客户名称长度不能超过64")
    @TableField(value = "customer_name", condition = LIKE)
    @Excel(name = "客户名称")
    private String customerName;

    /**
     * 联系人id
     */
    @ApiModelProperty(value = "联系人id")
    @TableField(value = "contact_id")
    @Excel(name = "联系人id")
    private Long contactId;

    /**
     * 联系人姓名
     */
    @ApiModelProperty(value = "联系人姓名")
    @Size(max = 20, message = "联系人姓名长度不能超过20")
    @TableField(value = "contact_name", condition = LIKE)
    @Excel(name = "联系人姓名")
    private String contactName;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    @Size(max = 1000, message = "备注长度不能超过1000")
    @TableField(value = "remark", condition = LIKE)
    @Excel(name = "备注")
    private String remark;

    /**
     * 商机性质，同名数据字典
     */
    @ApiModelProperty(value = "商机性质，同名数据字典")
    @Size(max = 64, message = "商机性质，同名数据字典长度不能超过64")
    @TableField(value = "business_property", condition = LIKE)
    @Excel(name = "商机性质，同名数据字典")
    private String businessProperty;

    /**
     * 商机类型，同名数据字典
     */
    @ApiModelProperty(value = "商机类型，同名数据字典")
    @Size(max = 64, message = "商机类型，同名数据字典长度不能超过64")
    @TableField(value = "business_type", condition = LIKE)
    @Excel(name = "商机类型，同名数据字典")
    private String businessType;

    /**
     * 线索id
     */
    @ApiModelProperty(value = "线索id")
    @TableField(value = "sale_clue_id")
    @Excel(name = "线索id")
    private Long saleClueId;

    /**
     * 线索来源（如绑定线索则该线索来源否则用户自己填）
     */
    @ApiModelProperty(value = "线索来源（如绑定线索则该线索来源否则用户自己填）")
    @Size(max = 255, message = "线索来源（如绑定线索则该线索来源否则用户自己填）长度不能超过255")
    @TableField(value = "sale_clue_source", condition = LIKE)
    @Excel(name = "线索来源（如绑定线索则该线索来源否则用户自己填）")
    private String saleClueSource;

    /**
     * 预计销售金额
     */
    @ApiModelProperty(value = "预计销售金额")
    @TableField(value = "estimate_sales_amount")
    @Excel(name = "预计销售金额")
    private BigDecimal estimateSalesAmount;

    /**
     * 销售阶段（数据字典）
     */
    @ApiModelProperty(value = "销售阶段（数据字典）")
    @Size(max = 255, message = "销售阶段（数据字典）长度不能超过255")
    @TableField(value = "sales_stage", condition = LIKE)
    @Excel(name = "销售阶段（数据字典）")
    private String salesStage;

    /**
     * 预计签单日期
     */
    @ApiModelProperty(value = "预计签单日期")
    @TableField(value = "estimate_sign_bill")
    @Excel(name = "预计签单日期", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime estimateSignBill;

    /**
     * 成交机率
     */
    @ApiModelProperty(value = "成交机率")
    @Size(max = 20, message = "成交机率长度不能超过20")
    @TableField(value = "deal_probability", condition = LIKE)
    @Excel(name = "成交机率")
    private String dealProbability;

    /**
     * 商机阶段
     */
    @ApiModelProperty(value = "商机阶段")
    @Size(max = 255, message = "商机阶段长度不能超过255")
    @TableField(value = "business_stage", condition = LIKE)
    @Excel(name = "商机阶段")
    private String businessStage;

    /**
     * 客户举办类型 (SPONSOR:主办;UNDERTAKE:承办)
     */
    @ApiModelProperty(value = "客户举办类型 (SPONSOR:主办;UNDERTAKE:承办)")
    @Size(max = 64, message = "客户举办类型 (SPONSOR:主办;UNDERTAKE:承办)长度不能超过64")
    @TableField(value = "customer_identity", condition = LIKE)
    @Excel(name = "客户举办类型 (SPONSOR:主办;UNDERTAKE:承办)")
    private String customerIdentity;

    /**
     * 最后跟进时间
     */
    @ApiModelProperty(value = "最后跟进时间")
    @TableField(value = "last_follow_date")
    @Excel(name = "最后跟进时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime lastFollowDate;

    /**
     * 下次跟进时间
     */
    @ApiModelProperty(value = "下次跟进时间")
    @TableField(value = "next_follow_date")
    @Excel(name = "下次跟进时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime nextFollowDate;


    @Builder
    public BusinessOpportunity(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Integer isEnabled, Integer isDeleted, Long projectId, Long subsystemId, Long tenantId, 
                    Long orgCode, String orgName, Long lastOrgCode, String lastOrgName, Long belongTo, String belongToName, 
                    Long lastBelongTo, String lastBelongToName, String businessTitle, Long customerId, String customerName, Long contactId, 
                    String contactName, String remark, String businessProperty, String businessType, Long saleClueId, String saleClueSource, 
                    BigDecimal estimateSalesAmount, String salesStage, LocalDateTime estimateSignBill, String dealProbability, String businessStage, String customerIdentity, 
                    LocalDateTime lastFollowDate, LocalDateTime nextFollowDate) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.tenantId = tenantId;
        this.orgCode = orgCode;
        this.orgName = orgName;
        this.lastOrgCode = lastOrgCode;
        this.lastOrgName = lastOrgName;
        this.belongTo = belongTo;
        this.belongToName = belongToName;
        this.lastBelongTo = lastBelongTo;
        this.lastBelongToName = lastBelongToName;
        this.businessTitle = businessTitle;
        this.customerId = customerId;
        this.customerName = customerName;
        this.contactId = contactId;
        this.contactName = contactName;
        this.remark = remark;
        this.businessProperty = businessProperty;
        this.businessType = businessType;
        this.saleClueId = saleClueId;
        this.saleClueSource = saleClueSource;
        this.estimateSalesAmount = estimateSalesAmount;
        this.salesStage = salesStage;
        this.estimateSignBill = estimateSignBill;
        this.dealProbability = dealProbability;
        this.businessStage = businessStage;
        this.customerIdentity = customerIdentity;
        this.lastFollowDate = lastFollowDate;
        this.nextFollowDate = nextFollowDate;
    }

}
